import http from '../../http'
// 初始下拉框
const initcategories = async () => {
    let data = await http({
        method: 'GET',
        url: 'categories',
    })
    return data
}
// 获取数据
const initparams = async (obj) => {
    let data = await http.get(`categories/${obj.id}/attributes`, { params: { sel: obj.attr_sel } })
    return data
}
// 添加
const additem = async (obj) => {
    let data = await http.post(`categories/${obj.id}/attributes`, obj)
    return data
}
// 删除
const deleteitem = async (obj) => {
    let data = await http.delete(`categories/${obj.id}/attributes/${obj.attrid}`)
    return data
}
// 编辑回填
const huitian = async (obj) => {
    let data = await http.get(`categories/${obj.id}/attributes/${obj.attrid}`, { data: obj })
    return data
}
// 编辑提交参数
const updataitem = async (obj) => {
    let data = await http.put(`categories/${obj.id}/attributes/${obj.attrid}`, obj)
    return data
}
// 添加tag标签
const addtag = async (obj) => {
    let data = await http.put(`categories/${obj.id}/attributes/${obj.attrid}`, obj)
    return data
}
export {
    initcategories,
    initparams,
    additem,
    deleteitem,
    huitian,
    updataitem,
    addtag,
}